import axios from 'axios'
import React, { useState, useEffect } from 'react'

export default function WebCar() {
    const [list, setList] = useState([])
    //查询车辆信息的集合
    const fetchCarListApi = async () => {
        let result = await axios.get('http://39.106.34.185:8888/webCar')
        console.log(result.data.data.list);
        setList(result.data.data.list)
    }
    useEffect(() => {
        fetchCarListApi()
    }, [])
    return (
        <div>
            <table>
                <thead>
                    <tr>
                        <td>车牌号码</td>
                        <td>所属用户</td>
                        <td>订单数量</td>
                        <td>未缴费订单</td>
                        <td>消费金额</td>
                        <td>代缴费金额</td>
                        <td>创建时间</td>
                        <td>操作</td>
                    </tr>
                </thead>
                <tbody>
                    {
                        list.map(item => <tr key={item.id}>
                            <td>{item.licensePlate}</td>
                            <td>{item.userName}</td>
                            <td>{item.orderNumber}</td>
                            <td>{item.noOrderNumber}</td>
                            <td>{item.money}</td>
                            <td>{item.payCost}</td>
                            <td>{item.createTime}</td>
                            <td>
                                <button>订单记录</button>
                            </td>
                            
                        </tr>)
                    }
                </tbody>
            </table>
        </div>
    )
}
